<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>水果分类管理</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('Material/addfruitclassify')}">新 增</a>
        </div>
        <div class="tools auth-botton">
            <a url="{:U('changestatus',array('method'=>'resume','table'=>'material_fruitclassify'))}" class="btn ajax-post" target-form="ids" >启 用</a>
            <a url="{:U('changestatus',array('method'=>'forbid','table'=>'material_fruitclassify'))}" class="btn ajax-post" target-form="ids" >禁 用</a>
        </div>
    </div>

    <div class="cf">
        <div class="search-form fr cf">
            <div class="sleft">
                <select name="type" class="search-input" style="height: 30px;width:120px">
                    <option value="">所有状态类型</option>
                    <option value="1" {$type==1?"selected":""}>正常</option>
                    <option value="0" {$type==0?"selected":""}>禁用</option>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="fruit_classify" class="search-input" value="{:I('fruit_classify')}" placeholder="请输入商品名称">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('fruitclassifymanage')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>

    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table>
    <thead>
        <tr>
            <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
            <th>编号</th>
            <th>水果分类名</th>
            <th>榨汁期</th>
            <th>处理期</th>
            <th>状态</th>
            <th>操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input  type="checkbox" class="ids" name="id[]" value="{$vo.id}" /></td>
            <td>{$vo.fruit_classify_no} </td>
            <td><a href="{:U('pnamemanage',array('belong_to'=>$vo['fruit_classify_no']))}">{$vo.fruit_classify}</a></td>
            <td>{$vo.per2_time}</td>
            <td>{$vo.per3_time}</td>
            <td>{$vo.status|get_material_status}</td>
            <td>
                <a class="btn btn-primary" href="{:U('Material/editfruitclassify',array('id'=>$vo['id']))}">编辑</a>
            </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        var queryselect  = $('.search-form').find('select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        queryselect = queryselect.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
            url += '&' + queryselect;
        }else{
            url += '?' + query;
            url += '&' + queryselect;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        
        //导航高亮
        highlight_subnav('{:U('Material/fruitclassifymanage')}');
    </script>
</block>
